/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package SynchronizationLayer;

import java.net.InetAddress;
import java.util.Objects;
import org.joda.time.DateTime;

/**
 *
 * @author Tomasz Nowak
 */
public class ExpectedPacket
{
	InetAddress address;
	NotarySynchronizationMessageType[] type;
	DateTime deadline;

	public DateTime getDeadline()
	{
		return deadline;
	}

	@Override
	public boolean equals( Object obj )
	{
		if ( obj == null )
		{
			return false;
		}
		if ( getClass() != obj.getClass() )
		{
			return false;
		}
		final ExpectedPacket other = ( ExpectedPacket ) obj;
		if ( !Objects.equals(this.address, other.address) )
		{
			return false;
		}
		return this.type == other.type;
	}

	public InetAddress getAddress()
	{
		return address;
	}

	public void setAddress( InetAddress address )
	{
		this.address = address;
	}

	public NotarySynchronizationMessageType[] getType()
	{
		return type;
	}

	public void setType( NotarySynchronizationMessageType[] type )
	{
		this.type = type;
	}

	public ExpectedPacket( InetAddress address, NotarySynchronizationMessageType[] type, DateTime deadline )
	{
		this.address = address;
		this.type = type;
		this.deadline = deadline;
	}

	public ExpectedPacket( InetAddress address, NotarySynchronizationMessageType[] type )
	{
		this(address, type, null);
	}
}
